(label: Refresh Editing View) Refreshing the Editing View
The script contained in this frame refreshes the editing view that the user sees when they press one of the XYZ buttons and is called from the script within these buttons.
Frame 9 is basically the reverse of frame 8. Where frame 8 reset the x, y and z co-ordinates of the individual points in the 3D view based on the positions of the points in the editing view, frame 9 sets the positions of the points in the editing view relative to the points in the 3D view. The script in this frame is executed when the viewer presses one of the X, Y, and Z buttons in the top right-hand corner.
The scripts used in frames eight and nine can be a bit hair-raising but letΓÇÖs look at how this could work for you. IΓÇÖll recap and summarise what weΓÇÖve been doing throughout the movie.
First we set the individual vertex coordinates (Variables:"x1","y1","z1", "x2", etc.) which gave the individual points a position in the ΓÇÿworldΓÇÖ ( frame 2 ).
Then we set rotation angles (Variable:"Xangle" and "Yangle") based on the position of "/Mouseloc" (frame 6).The above rotation angles, and the vertex coordinates and the "perspective" variable were then used by the script in frame 7 (3D Calc) to derive at a X and Y screen coordinate for each point, as well as a scale value. The point that I want to emphasize here is that the script in frame 7 (3D Calc) is continually executed, each time taking the vertex coordinates, rotation angles and perspective value and calculating new screen coordinates for each point.
So, essentially, you could change any of these variables at any time and the 3D view will be updated. This is what we did in frame 8, where we changed the original x, y and z coordinates for the individual points. These changed variables are then being used by frame 7 to calculate new screen coordinates.
LetΓÇÖs do a little experiment:
Change the script in frame 4 ( Label: "Main Looping Script") to read:
call ("Refresh 3D View"0;
call ("Mousetracking"0;
call ("Calc3d);
Delete the script in frame 8 (Label "Refresh 3D View) and replace it with the following script:
z5 = z5+madd;
if (z% >100 or z% < -100) {
madd = -madd
}
Add this line in frame 3 (label: "Setup"):
madd = -10;
When you run the movie, youΓÇÖll see that "/Vertex5" automatically moves forward and backwards on the Z-Axis. This is because weΓÇÖre continually adding the value of Variable: "add" (which starts out as ΓÇö10) to Variable: "z5" which represents its z ΓÇöcoordinate. If the value of Variable: "z5" is smaller than ΓÇö100, or greater than 100, Variable: "add" is set to ΓÇöadd. This constrains the movement to a limit of 100 units away from the center point.
This is just a simple example of how the position of individual points could be controlled but you can create more complex movements. Experiment 5 on www.wireframe.co.za is based on this principal. If youΓÇÖre a game developer, you could base a number of interesting games on this method.
Whether you simply want to create a rotating 3Dmenu (remember, the individual points can contain any graphic or buttons, even text) or whether you want to pursue something more complex, such as the creation of a 3D game, this technique should come in very handy.